package com.j1903.bean;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Users {
    private Long id;
    private String userName;
    private String userPwd;
    private Long roleId;
    private Integer userSex;
    @TableField(exist = false)
    private String sexName;
    public  String getSexName(){
        if (this.userSex==1){ return "男";}
        else {return "女";}
    }
    //给表中不存在的字段设置exist=false
    //mybatis就不会自动映射字段
    @TableField(exist = false)
    private Roles roles;
    private Integer deleted;
    @TableField(fill = FieldFill.INSERT)
    private Date createdDate;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedDate;

    public Users(String userName,String userPwd){
        this.userName=userName;
        this.userPwd=userPwd;
    }
}
